import logging

import pytest

from resource.pom.camera import Camera


class Test:
    app = Camera

    @pytest.mark.parametrize('setup_teardown', [app.bundle_name], indirect=True)
    def test(self, setup_teardown, device):
        for i in range(5):
            logging.info('步骤1.{}：进入相机应用'.format(i))
            device.start_ability(self.app.bundle_name, self.app.ability_name)
            logging.info('预期结果1.{}：相机打开无卡死，黑屏，白屏等现象'.format(i))
            device.assert_current_window(self.app.window_name)
            device.refresh_layout()
            device.assert_text_exist('拍照')
            device.assert_text_exist('录像')
            device.go_back()
